#include "Possion.h"


int main(int argc, char* argv[]){
  std::string meshfile,error,garbage;
  int acc,index;
  std::fstream Input(argv[1]);
  while (getline(Input,garbage,'\n')){
    Input >> index >> meshfile >> acc >> error;
    EasyMesh Mesh(meshfile);
    VectorXd Solution = Possion_Easymesh(Mesh,acc,1e-15);
    double err;
    if (error == "useless_error")
      err = useless_error(Mesh,Solution);
    else if (error == "prior_error")
      err = prior_error(Mesh,Solution,3);
    plots_matlab(Mesh,Solution);
    std::cout << "Problem " << index << ": " << std::endl;
    std::cout << "The error of problem = " << err << std::endl;
    std::cout << "Run result.m by matlab to get the effect of the solution." <<std::endl;
  }
  Input.close();
  std::cout << "All done!" << std::endl;
  return 0;
}
